function [phi,PMarkov] = dreumProb2(H,K)
% Calculate success probabilities for each lottery (PHI), and Markov transition
% matrix (PMarkov)


% Import success probabilities data for each site, preference point stock
phi = csvread('phi.csv',0,0,'A1..J22');
phi = [zeros(1,K); phi; ones(1,K)];

% Calculate Markov transition matrix
PMarkov = zeros(K,K,H+1);
for idx1 = 1:H+1 % idx1 = 1 == pp-only option; idx1 = 24 = opt out of lottery

    if idx1 < H+1
    
        for idx2 = 1:K
        
            % Assign success probabilities
            P = phi(idx1,idx2);
        
            % Transition to zero pts if successfully drawn
            PMarkov(idx2,1,idx1) = P;
		
            % Transition to k + 1 pts if not drawn
            PMarkov(idx2,min(idx2+1,K),idx1) = 1 - P;
                    
        end
    
    else
        
        PMarkov(:,:,idx1) = eye(K);
        
    end
        
end
